﻿<%@ Page Title="Book Open Trip" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="BookOpenTrip.aspx.cs" Inherits="IFD2.BookOpenTrip" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server" role="form" class="form-inline">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
    <div class="container-fluid body-content" style="width:100%;">

    <div class="row">
        <div class="col-sm-2 well well-sm">
            <h5><asp:Literal ID="litTitle" runat="server" meta:resourcekey="tipPageTitle"></asp:Literal></h5>
        </div>

        <div class="col-sm-10 well well-sm">
            <div class="panel">
                <div class="panel-heading btn-primary">
                    <h6 class="panel-title" id="section-2"><asp:Literal ID="Literal1" runat="server" meta:resourcekey="AvailableFlights"></asp:Literal></h6>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <asp:GridView ID="grdFlights" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="airline,flt_no,flt_date" class="table-hover"
                            DataSourceID="sqlFlights" ForeColor="#333333" GridLines="None" ondatabound="grdFlights_DataBound" style="min-width:1500px;width:100%;">
                            <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <input name="KEY" type="radio" value='<%# Eval("airline")+"|"+Eval("flt_no")+"|"+Convert.ToDateTime(Eval("flt_date")).ToShortDateString()+"|"+Eval("ori_airport")+"|"+Eval("des_airport")+"|"+Eval("cabin")+"|"+Eval("class") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="dep_time" HeaderText="dep_time" 
                                    SortExpression="dep_time"  meta:resourcekey="dep_time" />
                                <asp:BoundField DataField="arr_time" HeaderText="arr_time" 
                                    SortExpression="arr_time"  meta:resourcekey="arr_time" />
                                <asp:TemplateField HeaderText="flight" meta:resourcekey="flight">
                                    <ItemTemplate>
                                        <%# Eval("airline") +""+ Eval("flt_no") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="flt_date" HeaderText="flt_date" ReadOnly="True" 
                                    SortExpression="flt_date"  meta:resourcekey="flt_date" />
                                <asp:BoundField DataField="cabin_sn" HeaderText="cabin_sn" 
                                    SortExpression="cabin_sn"  meta:resourcekey="cabin_sn" />
                                <asp:TemplateField HeaderText="cabin_avail" meta:resourcekey="cabin_avail">
                                    <ItemTemplate>
                                        <%# Eval("cabin") + ":" + Eval("cabin_avail")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="class_sn" HeaderText="class_sn"  Visible="false"
                                    SortExpression="class_sn"  />
                                <asp:TemplateField HeaderText="class_avail" meta:resourcekey="class_avail">
                                    <ItemTemplate>
                                        <%# Eval("class") + ":" + Eval("class_avail")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="class_status" HeaderText="class_status" 
                                    SortExpression="class_status"  meta:resourcekey="class_status" />
                                <asp:BoundField DataField="ac_type" HeaderText="ac_type" 
                                    SortExpression="ac_type"  meta:resourcekey="ac_type" />
                                <asp:BoundField DataField="ori_name" HeaderText="ori_name" ReadOnly="True" 
                                    SortExpression="ori_name"  meta:resourcekey="ori_name" />
                                <asp:BoundField DataField="ori_airport" HeaderText="ori_airport" 
                                    SortExpression="ori_airport" Visible="false"  />
                                <asp:BoundField DataField="ori_terminal" HeaderText="ori_terminal" 
                                    SortExpression="ori_terminal"  meta:resourcekey="ori_terminal" />
                                <asp:BoundField DataField="des_name" HeaderText="des_name" ReadOnly="True" 
                                    SortExpression="des_name"  meta:resourcekey="des_name" />
                                <asp:BoundField DataField="des_airport" HeaderText="des_airport" 
                                    SortExpression="des_airport"  Visible="false" />
                                <asp:BoundField DataField="des_terminal" HeaderText="des_terminal" 
                                    SortExpression="des_terminal"  meta:resourcekey="des_terminal" />
                                <asp:CheckBoxField DataField="international" HeaderText="international" meta:resourcekey="international"
                                    SortExpression="international" />
                                <asp:BoundField DataField="query_date" HeaderText="query_date" ReadOnly="True" ControlStyle-Width="1px"
                                    SortExpression="query_date" Visible="false" />
                            </Columns>
                            <EditRowStyle BackColor="#2461BF" />
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#EFF3FB" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#F5F7FB" />
                            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                            <SortedDescendingCellStyle BackColor="#E9EBEF" />
                            <SortedDescendingHeaderStyle BackColor="#4870BE" />
                        </asp:GridView>

                        <asp:HiddenField ID="hidOrderID" runat="server" />
                        <asp:HiddenField ID="hidPaxSn" runat="server" />
                        <asp:HiddenField ID="hidTripSn" runat="server" />
                        <asp:HiddenField ID="hidFltDate" runat="server" />
                        <asp:SqlDataSource ID="sqlFlights" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>" 
                            SelectCommand="bll_query_get_open_trip_avail_flts" SelectCommandType="StoredProcedure">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="hidOrderID" Name="bk_id" PropertyName="Value" Type="Int64" />
                                <asp:ControlParameter ControlID="hidPaxSn" Name="pax_sn" PropertyName="Value" Type="Int16" />
                                <asp:ControlParameter ControlID="hidTripSn" Name="trip_sn" PropertyName="Value" Type="Byte" />
                                <asp:ControlParameter ControlID="hidFltDate" Name="flt_date" PropertyName="Value" Type="DateTime" />
                                <asp:SessionParameter Name="lang" SessionField="LANG" Type="Byte" />
                                <asp:SessionParameter Name="user_airline" SessionField="AIRLINE" Type="String" />
                                <asp:SessionParameter Name="user_office" SessionField="OFFICE" Type="String" />
                                <asp:SessionParameter Name="user" SessionField="USER" Type="String" />
                                <asp:Parameter Name="ip_addr" Type="String" DefaultValue="Request.UserHostAddress.ToString()" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>

                    <div class="btn-group">
                        <asp:Button ID="btnLastDate" runat="server" Text="&lt;" CssClass="btn btn-sm btn-default" onclick="btnLastDate_Click"  />
                        <asp:Button ID="btnCurrDate" runat="server" CssClass="btn btn-sm btn-default" />
                        <asp:Button ID="btnNextDate" runat="server" Text="&gt;" CssClass="btn btn-sm btn-default" onclick="btnNextDate_Click"  />
                    </div>
                    <br />
                    <asp:Label ID="lblError" runat="server" CssClass="ifdMessage"></asp:Label><br />
                    <asp:Button ID="btnBook" runat="server" onclick="btnBook_Click" Text="Book" CssClass="btn btn-sm btn-default"  meta:resourcekey="Book" />
                </div>
            </div>
        </div>
    </div>

    </div>
    </ContentTemplate></asp:UpdatePanel>
    </form>

</asp:Content>
